<template>
	<view>
		<navBar title="AI合同起草"></navBar>
		<view class="Wrapper">
			<view class="list" v-for="(item, index) in pageData" :key="index" @click="toHome(item)">
				<text class="question ellipsis_1">{{ item.question }}</text>
				<view class="iconfont icon-jiantou_xiangyouliangci_o icon-jiantou"></view>
			</view>
		</view>
	</view>
</template>

<script setup>
	import { onLoad, onShow, onReady, onShareAppMessage, onShareTimeline } from '@dcloudio/uni-app';
	import { ref, computed, watch, nextTick, onUnmounted } from 'vue';
	import {
		toUrl,
		toLogin,
		Toast,
		formatter,
		tampToDate,
		staticImg,
		imgUrls,
		showLoading,
		hideLoading,
		toRect,
		toPage,
		getFileExtension,
		previewFile,
	} from '@/utils/utils.js';
	import Http from '@/utils/request.js';
	import { useMainStore } from '@/stores/index';

	const mainStore = useMainStore();
	const pageData = ref([]);

	onLoad(() => {
		consultType();
	});

	const consultType = () => {
		Http.get({
			url: '/advice/consultType',
			data: {
				id: '922816755145900032',
			},
		}).then((res) => {
			if (res.code != 0) return Toast(res.msg);
			const result = res.data.children || [];
			pageData.value = result;
		});
	};

	const toHome = (Item) => {
		toUrl(`/pages/index/index?question=${Item.question}&competencyType=2`);
		console.log(Item);
	};
</script>

<style lang="scss">
	page {
		background-color: $page;
		padding-bottom: 30rpx;
	}
</style>
<style lang="scss" scoped>
	.Wrapper {
		width: 690rpx;
		margin: 0 auto;
		.list {
			width: 100%;
			height: 80rpx;
			display: flex;
			align-items: center;
			background-color: #fff;
			border-radius: 10rpx;
			padding: 0 20rpx;
			margin-top: 20rpx;
			.question {
				flex: 1;
				color: #333;
				font-size: 28rpx;
			}
			.icon-jiantou {
				color: $color_008;
				font-size: 32rpx;
			}
		}
	}
</style>
